/// @tags: DP
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int const N = 1e2 + 5, mod = 20040701;

int n, m, mc, maxd, tot, mx;
int a[N], w[N], C[N], f[N][N];
pair<int, int> pl[N * N * N];

struct Node {
  int i, F, L;
};

struct HashTable {
  struct Edge {
    int x, y, nxt;
  } e[N * N * N];

  int hash[mod], cnt;

  inline void add(int x, int y) {
    int pos = ((LL)x * N + y) % mod;
    e[++cnt] = (Edge){x, y, hash[pos]};
    hash[pos] = cnt;
  }

  inline bool find(int x, int y) {
    int pos = ((LL)x * N + y) % mod;
    for (int i = hash[pos]; i; i = e[i].nxt)
      if (e[i].x == x && e[i].y == y) return true;
    return false;
  }
} ht;

inline void bfs() {
  queue<Node> q;
  q.push((Node){1, 1, 0});
  while (!q.empty()) {
    Node u = q.front();
    q.pop();
    if (u.i == maxd) continue;
    q.push((Node){u.i + 1, u.F, u.L + 1});
    if (u.L > 1 && (LL)u.F * u.L <= mx && !ht.find(u.F * u.L, u.i + 1)) {
      q.push((Node){u.i + 1, u.F * u.L, u.L});
      pl[++tot] = make_pair(u.F * u.L, u.i + 1);
      ht.add(u.F * u.L, u.i + 1);
    }
  }
}

inline int main() {
  cin >> n >> m >> mc;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) cin >> w[i];
  for (int i = 1; i <= m; ++i) cin >> C[i], mx = max(mx, C[i]);
  for (int i = 1; i <= n; ++i)
    for (int j = a[i]; j <= mc; ++j) {
      f[i][j - a[i]] = max(f[i - 1][j] + 1, f[i][j - a[i]]);
      f[i][min(j - a[i] + w[i], mc)] = max(f[i - 1][j], f[i][min(j - a[i] + w[i], mc)]);
    }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= mc; ++j) maxd = max(maxd, f[i][j]);
  bfs();
  sort(pl + 1, pl + tot + 1);
  for (int i = 1; i <= m; ++i) {
    if (C[i] <= maxd) {
      cout << "1\n";
      continue;
    }
    bool flag = false;
    int mm = -0x3f3f3f3f;
    for (int j = tot, k = 1; j; --j) {
      while (k < tot && pl[k].first + pl[j].first <= C[i])
        mm = max(mm, pl[k].first - pl[k].second), ++k;
      if (mm >= C[i] - maxd - pl[j].first + pl[j].second) {
        flag = true;
        break;
      }
      if (pl[j].first <= C[i] && C[i] - pl[j].first <= maxd - pl[j].second) {
        flag = true;
        break;
      }
    }
    cout << (flag ? "1\n" : "0\n");
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3724 [AHOI2017 HNOI2017] 大佬.in", "r", stdin);
  freopen("P3724 [AHOI2017 HNOI2017] 大佬.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
